package com.yeeKa.utils;

// 引入的Jar包

import com.baomidou.mybatisplus.annotation.TableField;

import java.lang.reflect.Field;
import java.util.HashMap;

public class TableFieldUtil {
    public static HashMap<String,String> getProxyPojoValue(Object object){
        // 返回参数
        HashMap<String,String> hashMap = new HashMap<>(16);
            Field[] fields = object.getClass().getDeclaredFields();
            for (Field field : fields) {
                field.setAccessible(true);
                // 获取字段的值
                boolean isTableField = field.isAnnotationPresent(TableField.class);
                if (isTableField) {
                    TableField tableField = field.getAnnotation(TableField.class);
                    String fieldName = field.getName();
                    String fieldValue = tableField.value();
                    hashMap.put(fieldName,fieldValue);
                }
            }
        return hashMap;
    }
}
